Skip to content

feat: add Broadcasts.cancel() and cancel_async() - #250

Open
dielduarte wants to merge 1 commit into
mainfrom
broadcasts-cancel
Open

feat: add Broadcasts.cancel() and cancel_async()#250
dielduarte wants to merge 1 commit into
mainfrom
broadcasts-cancel

Conversation

@dielduarte

@dielduarte dielduarte commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds Broadcasts.cancel(id) / cancel_async(id), calling POST /broadcasts/:id/cancel to cancel a queued or scheduled broadcast.
  • Mirrors Emails.cancel()'s shape (empty params, id-only).
  • Adds Broadcasts.CancelResponse (object + id).

Part of the broadcast cancel rollout: resend/resend-monorepo#8126, resend/resend-openapi#85, resend/resend-node#1059, resend/resend-docs#1722, resend/resend-go#144, resend/resend-java#122, resend/resend-php#135.

Test plan

  • pytest tests/broadcasts_test.py tests/broadcasts_async_test.py — 24/24 passing
  • mypy resend/broadcasts/ — clean

🤖 Generated with Claude Code


Summary by cubic

Adds cancel support for broadcasts. Introduces Broadcasts.cancel(id) and cancel_async(id) to stop queued or scheduled sends via POST /broadcasts/:id/cancel, matching Emails.cancel().

  • New Features
    • Added Broadcasts.cancel(id) and cancel_async(id) to cancel queued/scheduled broadcasts.
    • Added Broadcasts.CancelResponse (returns object and id).

Written for commit 162fab3. Summary will update on new commits.

Review in cubic

Cancels a queued or scheduled broadcast via POST /broadcasts/:id/cancel,
mirroring Emails.cancel()'s shape (empty params, id-only).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Confidence score: 5/5

  • In tests/broadcasts_async_test.py, cancel_async is only covered on the success path, so a no-content response regression could slip through without catching an expected NoContentError; add a set_mock_json(None) failure-path test for cancel_async to align with the rest of the file’s exception coverage.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="tests/broadcasts_async_test.py">

<violation number="1" location="tests/broadcasts_async_test.py:136">
P3: The cancel_async coverage here only exercises the success path. Every other method in this file has a paired raise-exception-when-no-content test; add one for cancel_async (set_mock_json(None), expect NoContentError) to keep the error path covered and consistent with the rest of the suite.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

}
)

canceled = await resend.Broadcasts.cancel_async(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The cancel_async coverage here only exercises the success path. Every other method in this file has a paired raise-exception-when-no-content test; add one for cancel_async (set_mock_json(None), expect NoContentError) to keep the error path covered and consistent with the rest of the suite.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/broadcasts_async_test.py, line 136:

<comment>The cancel_async coverage here only exercises the success path. Every other method in this file has a paired raise-exception-when-no-content test; add one for cancel_async (set_mock_json(None), expect NoContentError) to keep the error path covered and consistent with the rest of the suite.</comment>

<file context>
@@ -125,6 +125,20 @@ async def test_should_send_broadcasts_async_raise_exception_when_no_content(
+            }
+        )
+
+        canceled = await resend.Broadcasts.cancel_async(
+            "78261eea-8f8b-4381-83c6-79fa7120f1cf"
+        )
</file context>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants